<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>01_平移-translate</title>
    <style>
      body,
      ul {
        margin: 0;
        padding: 0;
      }

      body {
        background-image: url(../../images/grid.png);
      }
      svg {
        background-color: rgba(255, 0, 0, 0.1);
      }
    </style>
  </head>
  <body>
    <svg width="300" height="300" xmlns="http://www.w3.org/2000/svg">
      <!-- 1. 平移一个元素 -->
      <rect
        x="0"
        y="0"
        width="100"
        height="50"
        transform="translate(200, 200)"
      ></rect>

      <!-- 2.平移一个元素, 在元素的内部会创建一个新的坐标系统 -->
      <rect
        transform="translate(100, 100)"
        x="-10"
        y="-10"
        width="100"
        height="50"
      ></rect>

      <g transform="translate(100, 100)">
        <rect x="10" y="10" width="100" height="50" fill="red"></rect>
      </g>
    </svg>
  </body>
</html>
